package com.lookme.lmtool.cracker.filter.blur;

import com.jhlabs.image.BlurFilter;
import com.jhlabs.image.BoxBlurFilter;
import com.jhlabs.image.SmartBlurFilter;
import com.lookme.lmtool.cracker.CrackerConstants;
import com.lookme.lmtool.cracker.annotation.FilterAnnotation;
import com.lookme.lmtool.cracker.annotation.ParamAnnotation;
import com.lookme.lmtool.cracker.filter.AbstractFilter;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;

import java.awt.image.BufferedImageOp;

@FilterAnnotation(groupName = CrackerConstants.FILTER_GROUP_NAME_BLUR,name="智能模糊",filterClass = SmartBlurFilter.class)
public class FilterSmartBlur extends AbstractFilter {
    @XStreamAsAttribute
    @ParamAnnotation(name = "水平半径", desc = "水平半径",inputType = ParamAnnotation.InputType.Slider,width = 300,amountToStepBy = 1,max=100,blockIncrement = 5,majorTickUnit=10)
    private int hRadius=5;
    @XStreamAsAttribute
    @ParamAnnotation(name = "垂直半径", desc = "垂直半径",inputType = ParamAnnotation.InputType.Slider,width = 300,amountToStepBy = 1,max=100,blockIncrement = 5,majorTickUnit=10)
    private int vRadius=5;
    @XStreamAsAttribute
    @ParamAnnotation(name = "阀值", desc = "阀值",inputType = ParamAnnotation.InputType.Slider,width = 300,amountToStepBy = 1,max=100,blockIncrement = 5,majorTickUnit=10)
    private int threshold=1;

    @Override
    public BufferedImageOp getFilter() {
        SmartBlurFilter filter =new SmartBlurFilter();
        filter.setHRadius(hRadius);
        filter.setVRadius(vRadius);
        filter.setThreshold(threshold);
        return filter;
    }
}
